package com.seo.textgen.pos.keyword;

public class WindowKeywordSelector implements TaggedKeywordSelector {

	private int position = 0;

	private TaggedKeyword[] keywords;

	private int windowSize;

	private TaggedKeyword[] result;

	public WindowKeywordSelector(TaggedKeyword[] keywords, int windowSize) {
		this.keywords = keywords;
		this.windowSize = windowSize;
		this.result = new TaggedKeyword[windowSize];
	}

	public TaggedKeyword[] selectKeywords() {
		for (int i = 0; i < windowSize; i++) {
			result[i] = keywords[(i + position) % windowSize];
		}
		position++;
		return result;
	}
}
